package com.gf.pf.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.gf.pf.mapper.DepartmentMapper;
import com.gf.pf.model.Department;
import com.gf.pf.model.Ztree;
import com.gf.pf.service.DepartmentService;

/**
 * @describe 部门
 * @date     2015年3月5日
 */
@Service
@Transactional
public class DepartmentServiceImpl implements DepartmentService {
	
	@Autowired
	private DepartmentMapper departmentMapper;
	
	/* (non-Javadoc)
	 * @see com.gf.pf.service.DepartmentService#findDep(java.lang.Long)
	 * 根据部门ID查询部门
	 */
	@Override
	public Department getDep(String depId) {
		return departmentMapper.getDep(depId);
	}

	/* (non-Javadoc)
	 * @see com.gf.pf.service.DepartmentService#getDepartmentZtree(java.lang.String)
	 * 根据ID查询根目录下的部门
	 */
	@Override
	public List<Ztree> getDepartmentZtree() {
		return departmentMapper.getDepartmentZtree();
	}

	/* (non-Javadoc)
	 * @see com.gf.pf.service.DepartmentService#saveDep(com.gf.pf.model.Department)
	 * 保存部门
	 */
	@Override
	public Integer saveDep(Department dep) {
		return departmentMapper.saveDep(dep);
	}

	/* (non-Javadoc)
	 * @see com.gf.pf.service.DepartmentService#modifyDep(com.gf.pf.model.Department)
	 * 部门修改
	 */
	@Override
	public Integer modifyDep(Department dep) {
		return departmentMapper.modifyDep(dep);
	}

	/* (non-Javadoc)
	 * @see com.gf.pf.service.DepartmentService#deleteDep(java.lang.String)
	 * 部门删除
	 */
	@Override
	public Integer deleteDep(String depId) {
		return departmentMapper.deleteDep(depId);
	}

}
